import { createSSRApp } from 'vue'
import { createPinia } from 'pinia'
import uviewPlus, { setConfig } from 'uview-plus'

import App from './App'
import http from '@/utils/http.ts'
import { createRouterInterceptor } from '@/interceptors/router'
import noticeBar from '@/pages/components/notice-bar.vue'
export function createApp () {
	const app = createSSRApp(App)
	const pinia = createPinia()
	app.component('noticeBar', noticeBar)
	app.use(http)
	app.use(pinia)
	app.use(uviewPlus)

	setConfig({
		config: {
			unit: 'rpx',
		},
	})

	createRouterInterceptor()

	return {
		app,
		pinia,
	}
}
